#define _CRT_SECURE_NO_WARNINGS 1

#include<string>
#include<iostream>
using namespace std;


int main()
{
	string str;
	string tmp;

	cin >> str;

	for (auto e : str)
	{
		if (tmp.empty()||e != tmp.back())
		{
			tmp += e;
		}
		else
		{
			tmp.pop_back();
		}
	}

	if (tmp.empty())
		cout << 0 << endl;
	else
		cout << tmp << endl;


	return 0;
}